package com.ytc.service;

import com.ytc.model.Booklist;
import com.ytc.model.User;
import com.ytc.model.Vip;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(value = "service-provider")
public interface UserService {


    /*柴晓颖：新增用户*/
    @RequestMapping("addUser")
    void addUser(@RequestBody User user);

    @RequestMapping("queryUserList")
    List<User> queryUserList();


    /*柴晓颖：修改用户角色id为作者*/
    @RequestMapping("updateRoleId")
    void updateRoleId(@RequestBody User user,@RequestParam("userResid") Integer userResid);

    //张泽萌
    @RequestMapping("queryUserById")
    User queryUserById(@RequestParam("uId") Integer uId);

    //张泽萌
    @RequestMapping("updateAuthor")
    void updateAuthor(@RequestBody User user);

    //柴晓颖：通过用户名查询用户
    @RequestMapping("queryUserByName")
    User queryUserByName(@RequestParam("uName") String uName);


    /*
    高媛：根据userid查询书架列表
     */
    @RequestMapping("queryBookShelfByUserid")
    List<Booklist> queryBookShelfByUserid(@RequestParam("userid") Integer userid);

    /*
    高媛：根据userid查询历史阅读列表
     */
    @RequestMapping("queryBookHistoryByUserid")
    List<Booklist> queryBookHistoryByUserid(@RequestParam("userid")Integer userid);

    /*
    高媛：根据书籍ID、章节ID、用户ID查询书籍本章及相关内容（连历史记录表）
     */
    @RequestMapping("queryBookByHistory")
    Booklist queryBookByHistory(@RequestParam("bookid")Integer bookid,@RequestParam("cid") Integer cid,@RequestParam("userid") Integer userid);

    /**
     * 高媛：根据书籍ID和用户ID删除历史阅读记录
     */
    @RequestMapping("delBookByHistory")
    void toDelBookByHistory(@RequestParam(value = "bookid",required = false,defaultValue = "0")Integer bookid,@RequestParam("userid") Integer userid);

    /*
    高媛：根据书籍ID、章节ID、用户ID查询书籍本章及相关内容（连书架表）
     */
    @RequestMapping("queryBookByShelf")
    Booklist queryBookByShelf(@RequestParam("bookid")Integer bookid,@RequestParam("cid") Integer cid,@RequestParam("userid") Integer userid);

    /**
     * 高媛：根据书籍ID和用户ID删除书架书籍
     */
    @RequestMapping("delBookByShelf")
    void toDelBookByShelf(@RequestParam(value = "bookid",required = false,defaultValue = "0")Integer bookid,@RequestParam("userid") Integer userid);

    /**
     * 高媛：根据用户ID查询用户信息
     * @param userid
     * @return
     */
    @RequestMapping("queryUserInfoById")
    User queryUserInfo(@RequestParam("userid") Integer userid);

    /**
     * 高媛：批量删除书架书籍
     */
    @RequestMapping("delsBooksByShelf")
    void delsBookShelf(@RequestParam("list")List<Integer> list,@RequestParam("userid") Integer userid);

    /**
     * 高媛：批量删除历史记录
     */
    @RequestMapping("delsBooksByHistory")
    void delsBookHistory(@RequestParam("list")List<Integer> list,@RequestParam("userid") Integer userid);
    /*
    高媛：从历史记录加入书架
     */
    @RequestMapping("historyAddToShelfById")
    void historyAddToShelf(@RequestParam("userid") Integer userid,@RequestParam("bookid") Integer bookid);

    /*高媛：批量从历史记录加入书架*/
    @RequestMapping("HistoryAddsShelfById")
    void HistoryAddsShelf(@RequestParam("list")List<Integer> list,@RequestParam("userid") Integer userid);


    //张阔：查询用户的角色
    @RequestMapping("isOrNotVip")
    Integer isOrNotVip(@RequestParam("uId") Integer uId);

    //张阔：查询会员信息
    @RequestMapping("queryVip")
    Vip queryVip(@RequestParam("uId") Integer uId);

    //张阔：修改用户权限为普通用户
    @RequestMapping("updateRole")
    void updateRole(@RequestParam("uId") Integer uId,@RequestParam("rId") Integer rId);

    //张阔：把会员过期时间加长
    @RequestMapping("updateDueTimeByMoney")
    void updateDueTimeByMoney(@RequestParam("money") double money,@RequestParam("uid") Integer uid);

    //张阔：新增vip
    @RequestMapping("addVipByMoney")
    void addVipByMoney(@RequestParam("money") double money,@RequestParam("uid") Integer uid);


}
